 #include<iostream>
 #include<pthread.h>
 #include<unistd.h>
 #include<string>

 void* nextPthread(void* args){
    const std::string str = (const char*)args;
    int i = 5;
    while (i--)
    {
        std::cout<<str<<getpid()<<std::endl;
        sleep(1);
        // int a = 10;
        // a /= 0;
    }
    int a = 10;
    // return (void*)10;
    pthread_exit((void*)a);
 }

 int main(){
    pthread_t tid;
    pthread_create(&tid,nullptr,nextPthread,(void*)"fuck you too");
    int i = 5;
    while(i--){
        std::cout<<"fuck you"<<getpid()<<std::endl;
        sleep(1);
    }
    //join可以不需要异常处理，因为如果发生异常整个进程退出
    void * ret = nullptr;
    pthread_join(tid,&ret);
    std::cout << (long long int)ret<< std::endl;
    return 0;
 }